package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.comment.bo.CommentBo;
import com.cskaoyan.bean.wx.comment.vo.CommentDetailVo;
import com.cskaoyan.bean.wx.comment.vo.CommentListVo;
import com.cskaoyan.bean.wx.comment.vo.CountVo;
import com.cskaoyan.service.wx.WxCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Name : WxCommentController.java
 * @Time : 2021/8/17 11:07
 * @Author : creamycandy
 * @Software : IntelliJ IDEA
 */
@RestController
@RequestMapping("wx/comment")
public class WxCommentController {


    @Autowired
    WxCommentService wxCommentService;

    @RequestMapping("list")
    public BaseRespVo getCommentList(Integer valueId, Byte type, Byte showType, Integer page, Integer size){
        CommentListVo commentList = wxCommentService.getCommentList(valueId, type, showType, page, size);
        return BaseRespVo.ok(commentList);
    }

    @RequestMapping("post")
    public BaseRespVo postComment(@RequestBody CommentBo commentBo){
        CommentDetailVo commentDetailVo = wxCommentService.postComment(commentBo);
        return BaseRespVo.ok(commentDetailVo);
    }

    @RequestMapping("count")
    public BaseRespVo getCount(Integer valueId, Byte type){
        CountVo count = wxCommentService.getCount(valueId, type);
        return BaseRespVo.ok(count);
    }
}
